package com.goldenlight.fvms.manager.utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class ConditionUtils {
    private static Map<String, Condition> conditionMap=new ConcurrentHashMap<>();
    private static Lock lock = new ReentrantLock();

    private ConditionUtils() {
    }

    public static Condition getCondition(String condition) {
        conditionMap.putIfAbsent(condition, lock.newCondition());
        return conditionMap.get(condition);
    }

    public static void removeCondition(String condition) {
        conditionMap.remove(condition);
    }


}
